<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ToastExample.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span>
<span class="MXMLComponent_Tag">&lt;s:Application</span><span class="MXMLDefault_Text"> xmlns:fx="</span><span class="MXMLString">http://ns.adobe.com/mxml/2009</span><span class="MXMLDefault_Text">"
               xmlns:s="</span><span class="MXMLString">library://ns.adobe.com/flex/spark</span><span class="MXMLDefault_Text">"
               xmlns:mx="</span><span class="MXMLString">library://ns.adobe.com/flex/mx</span><span class="MXMLDefault_Text">"
               minWidth="</span><span class="MXMLString">640</span><span class="MXMLDefault_Text">" minHeight="</span><span class="MXMLString">500</span><span class="MXMLDefault_Text">" backgroundColor="</span><span class="MXMLString">#CCCCCC</span><span class="MXMLDefault_Text">" 
               viewSourceURL="</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;fx:Script&gt;</span>
        &lt;![CDATA[
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">utils</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">setInterval</span>;
            
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">spark</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">components</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Toast</span>;
            
            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">showToastDefault</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// Create a default toast using the static convenience
</span>                <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">makeInstance</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"Lorem ipsum dolor sit amet"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">showToastAltParent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// Create a toast in a specific DisplayComponent instead of the default
</span>                <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">makeInstance</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"Lorem ipsum dolor sit amet"</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">SHORT_DELAY</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">subgrp</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">showToastStyled</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// Create a toast with a style applied
</span>                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">styledToast</span>:<span class="ActionScriptDefault_Text">Toast</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"I'm styling."</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">styledToast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">styleName</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">"styledToast"</span>;
                <span class="ActionScriptDefault_Text">styledToast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>

            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">showToastChangeLabel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// Create a toast then change the label
</span>                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">toast</span>:<span class="ActionScriptDefault_Text">Toast</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"Here is my first label. It is longer than the next one."</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">Toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">LONG_DELAY</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">show</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
                
                <span class="ActionScriptComment">// Change the label of the existing toast after 1.5 seconds
</span>                <span class="ActionScriptDefault_Text">setInterval</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptfunction">function</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">toast</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">label</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">'I changed.'</span>; <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptOperator">,</span> 1500<span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>            
        <span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;/fx:Script&gt;</span>
    
    <span class="MXMLSpecial_Tag">&lt;fx:Style&gt;</span>
        <span class="CSS@namespace">@namespace</span> <span class="CSSSelector">s </span><span class="CSSString">"library://ns.adobe.com/flex/spark"</span>;
        <span class="CSS@namespace">@namespace</span> <span class="CSSSelector">components </span><span class="CSSString">"spark.components.*"</span>;
        
        <span class="CSS@font-face">@font-face</span> 
        <span class="CSSDelimiters">{</span> 
            <span class="CSSProperty_Name">src</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">url(</span><span class="CSSString">"/assets/fonts/ARIAL.ttf"</span><span class="CSSProperty_Value">)</span><span class="CSSDelimiters">;</span> 
            <span class="CSSProperty_Name">fontFamily</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">arial</span><span class="CSSDelimiters">;</span> 
            <span class="CSSProperty_Name">embedAsCFF</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">false</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontWeight</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">normal</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">unicodeRange</span><span class="CSSDelimiters">:</span>
                <span class="CSSProperty_Value">U+0041-005A, </span><span class="CSSComment">/* Upper-Case [A..Z] */</span>
                <span class="CSSProperty_Value">U+0061-007A, </span><span class="CSSComment">/* Lower-Case a-z */</span>
                <span class="CSSProperty_Value">U+0030-0034, </span><span class="CSSComment">/* Numbers [0..4] */</span>
                <span class="CSSProperty_Value">U+002E-002E</span><span class="CSSDelimiters">;</span> <span class="CSSComment">/* Period [.] */</span>        
        <span class="CSSDelimiters">}</span>   
        
        <span class="CSS@font-face">@font-face</span>
        <span class="CSSDelimiters">{</span> 
            <span class="CSSProperty_Name">src</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">url(</span><span class="CSSString">"/assets/fonts/ARIALBD.ttf"</span><span class="CSSProperty_Value">)</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontFamily</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">arial</span><span class="CSSDelimiters">;</span> 
            <span class="CSSProperty_Name">embedAsCFF</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">false</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontWeight</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">bold</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">unicodeRange</span><span class="CSSDelimiters">:</span>
                <span class="CSSProperty_Value">U+0041-005A, </span><span class="CSSComment">/* Upper-Case [A..Z] */</span>
                <span class="CSSProperty_Value">U+0061-007A, </span><span class="CSSComment">/* Lower-Case a-z */</span>
                <span class="CSSProperty_Value">U+0030-0034, </span><span class="CSSComment">/* Numbers [0..4] */</span>
                <span class="CSSProperty_Value">U+002E-002E</span><span class="CSSDelimiters">;</span> <span class="CSSComment">/* Period [.] */</span>
        <span class="CSSDelimiters">}</span>   
        
        <span class="CSSSelector">global
        </span><span class="CSSDelimiters">{</span>
            <span class="CSSProperty_Name">fontFamily</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">arial</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontSize</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">16</span><span class="CSSDelimiters">;</span>
        <span class="CSSDelimiters">}</span>
        
        <span class="CSSSelector">components|Toast
        </span><span class="CSSDelimiters">{</span>
            <span class="CSSProperty_Name">skinClass</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">ClassReference(</span><span class="CSSString">"spark.skins.mobile.ToastSkin"</span><span class="CSSProperty_Value">)</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">contentBackgroundColor</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#000000</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">contentBackgroundAlpha</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">0.9</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">strokeColor</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#FFFFFF</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">strokeAlpha</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">0.65</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">cornerRadius</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">0</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">color</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#FFFFFF</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontSize</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">14</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontWeight</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">bold</span><span class="CSSDelimiters">;</span>
        <span class="CSSDelimiters">}</span>
        
        <span class="CSSSelector">.styledToast
        </span><span class="CSSDelimiters">{</span>
            <span class="CSSProperty_Name">contentBackgroundColor</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#990000</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">contentBackgroundAlpha</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">0.9</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">strokeColor</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#000000</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">strokeAlpha</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">0.65</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">cornerRadius</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">6</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">color</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">#D4A017</span><span class="CSSDelimiters">;</span>        
            <span class="CSSProperty_Name">fontSize</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">12</span><span class="CSSDelimiters">;</span>
            <span class="CSSProperty_Name">fontWeight</span><span class="CSSDelimiters">:</span> <span class="CSSProperty_Value">bold</span><span class="CSSDelimiters">;</span>
        <span class="CSSDelimiters">}</span>
        
    <span class="MXMLSpecial_Tag">&lt;/fx:Style&gt;</span>
    
    <span class="MXMLSpecial_Tag">&lt;fx:Declarations&gt;</span>
        <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> Place non-visual elements (e.g., services, value objects) here </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;/fx:Declarations&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;s:Group</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">grp</span><span class="MXMLDefault_Text">" left="</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">" top="</span><span class="MXMLString">100</span><span class="MXMLDefault_Text">" width="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" height="</span><span class="MXMLString">50%</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Rect</span><span class="MXMLDefault_Text"> width="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" height="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;s:fill&gt;</span>
                <span class="MXMLComponent_Tag">&lt;s:SolidColor</span><span class="MXMLDefault_Text"> color="</span><span class="MXMLString">#999999</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/s:fill&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/s:Rect&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Group</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">subgrp</span><span class="MXMLDefault_Text">" left="</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">" top="</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">" bottom="</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">" right="</span><span class="MXMLString">50</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;s:Rect</span><span class="MXMLDefault_Text"> width="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" height="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
                <span class="MXMLComponent_Tag">&lt;s:fill&gt;</span>
                    <span class="MXMLComponent_Tag">&lt;s:SolidColor</span><span class="MXMLDefault_Text"> color="</span><span class="MXMLString">#555555</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
                <span class="MXMLComponent_Tag">&lt;/s:fill&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/s:Rect&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/s:Group&gt;</span>
    <span class="MXMLComponent_Tag">&lt;/s:Group&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;s:HGroup</span><span class="MXMLDefault_Text"> left="</span><span class="MXMLString">8</span><span class="MXMLDefault_Text">" top="</span><span class="MXMLString">8</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> label="</span><span class="MXMLString">Toast (Default)</span><span class="MXMLDefault_Text">" click="</span><span class="ActionScriptDefault_Text">showToastDefault</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> label="</span><span class="MXMLString">Toast (Alternative Parent)</span><span class="MXMLDefault_Text">" click="</span><span class="ActionScriptDefault_Text">showToastAltParent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> label="</span><span class="MXMLString">Toast (Styled)</span><span class="MXMLDefault_Text">" click="</span><span class="ActionScriptDefault_Text">showToastStyled</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> label="</span><span class="MXMLString">Toast (Change Label)</span><span class="MXMLDefault_Text">" click="</span><span class="ActionScriptDefault_Text">showToastChangeLabel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;/s:HGroup&gt;</span>
<span class="MXMLComponent_Tag">&lt;/s:Application&gt;</span></pre></body>
</html>
